package com.whfp.afs330h_sdk;

import android.app.Application;

import com.clj.fastble.BleManager;
import com.whfp.afs330h_sdk.afs330h.BtManager;
import com.whfp.afs330h_sdk.afs330h.BtManagerImpl;



public final class zx {

    private static Application app;

    private static BtManager btManager;

    public static void init(Application app) {
        if (zx.app == null) {
            zx.app = app;
        }
        //初始化蓝牙连接框架
        BleManager.getInstance().init(app);
        BleManager.getInstance()
                .enableLog(true)
//                .setReConnectCount(1, 5000)
                .setSplitWriteNum(20)
                .setConnectOverTime(20000)
                .setOperateTimeout(5000);
    }

    public static void setAfs330hManager(BtManager btManager) {
        zx.btManager = btManager;
    }

    public static BtManager instance() {
        if (zx.btManager == null) {
            BtManagerImpl.registerInstance(app);
        }
        return zx.btManager;
    }
}
